package com.shengyin.ec.model.dao.cluster;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.shengyin.ec.model.dao.BaseDaoImpl;
import com.shengyin.ec.model.entity.ChainCompany;
import com.shengyin.ec.model.entity.Company;

@Repository("chainCompanyDao")
public class ChainCompanyDaoImpl extends BaseDaoImpl<ChainCompany> implements ChainCompanyDao  {

	@Override
	public void createChainCompany(ChainCompany chainCompany) {
		super.save(chainCompany);
	}

	@Override
	public List<ChainCompany> getChainCompanyList() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean checkChainCompanyUser(String username, String pwd) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public List<ChainCompany> getChainCompanyList(int offset, int pagesize) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<ChainCompany> getChainCompany(int status, int offset,
			int pagesize) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void deleteSelectedChainCompany(Long[] idsl) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public List<ChainCompany> getChainCompanyByName(String username) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<ChainCompany> getChainCompanyListByChainCompanyId(long id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Long getTotal() {
		// TODO Auto-generated method stub
		return null;
	}

	public List<ChainCompany> getChainCompanyListByCluster(long clusterCompanyid,int offset,int pageSize){
		
		return super.findByPage("from Company where clusterCompany_id = ? and companyType = '3'", clusterCompanyid, offset, pageSize);
	}
		
	public List<ChainCompany> getChainCompanyListByCluster(long clusterCompanyid){
		
		return super.find("from Company where clusterCompany_id = '"+clusterCompanyid+"' and companyType = '3'" );
	}
	
    public List<ChainCompany> searchChainByName(String[] paramValues ,int offset,int pageSize){
    	
    	return super.findByPage("from Company where clusterCompany_id=? and companyname like ?", paramValues, offset, pageSize);
    }
	
	public List<ChainCompany> searchChainByName(String[] paramValues){
		return super.find("from Company where clusterCompany_id=? and companyname like ?", paramValues);
	}

}



	
